home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / GP.H < prev    next >
C/C++ Source or Header  |  1992-03-19  |  6KB  |  143 lines

  1. /* Copyright (C) 1991, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gp.h */
  21. /* Interface to platform-specific routines for Ghostscript */
  22.  
  23. /*
  24.  * This file defines ***ALL*** the routines that are Ghostscript- and
  25.  * platform-specific.  The routines are implemented in a gp_*.c file
  26.  * specific to each platform.  We try very hard to keep this list short!
  27.  */
  28.  
  29. /* ------ Initialization ------ */
  30.  
  31. /* This routine is called early in the Ghostscript initialization. */
  32. /* It should do as little as possible.  In particular, it should not */
  33. /* do things like open display connections: that is the responsibility */
  34. /* of the display device driver. */
  35. extern void gp_init(P0());
  36.  
  37. /* ------ Date and time ------ */
  38.  
  39. /* Read the current date (in days since Jan. 1, 1980) into pdt[0], */
  40. /* and time (in milliseconds since midnight) into pdt[1]. */
  41. extern void gp_get_clock(P1(long *pdt));
  42.  
  43. /* ------ Screen management ------ */
  44.  
  45. /* These routines are only relevant in a single-window environment */
  46. /* such as a PC; on platforms with window systems, the 'make current' */
  47. /* routines do nothing. */
  48.  
  49. struct gx_device_s;
  50.  
  51. /* Write a string to the console. */
  52. extern void gp_console_puts(P2(const char *, uint));
  53.  
  54. /* Make the console current on the screen. */
  55. extern int gp_make_console_current(P1(struct gx_device_s *));
  56.  
  57. /* Make the graphics current on the screen. */
  58. extern int gp_make_graphics_current(P1(struct gx_device_s *));
  59.  
  60. /* ------ Printer accessing ------ */
  61.  
  62. /* Open a connection to a printer.  A null file name means use the */
  63. /* standard printer connected to the machine, if any. */
  64. /* If possible, support "|command" for opening an output pipe. */
  65. /* Return NULL if the connection could not be opened. */
  66. extern FILE *gp_open_printer(P1(char *fname));
  67.  
  68. /* Close the connection to the printer. */
  69. extern void gp_close_printer(P2(FILE *pfile, const char *fname));
  70.  
  71. /* ------ File names ------ */
  72.  
  73. /* Define the character used for separating file names in a list. */
  74. extern const char gp_file_name_list_separator;
  75.  
  76. /* Define the default scratch file name prefix. */
  77. extern const char gp_scratch_file_name_prefix[];
  78.  
  79. /* Define whether case is insignificant in file names. */
  80. extern const int gp_file_names_ignore_case;
  81.  
  82. /* Create and open a scratch file with a given name prefix. */
  83. /* Write the actual file name at fname. */
  84. extern FILE *gp_open_scratch_file(P3(const char *prefix, char *fname,
  85.                      const char *mode));
  86.  
  87. /* Answer whether a file name contains a directory/device specification, */
  88. /* i.e. is absolute (not directory- or device-relative). */
  89. extern int gp_file_name_is_absolute(P2(const char *fname, uint len));
  90.  
  91. /* Answer the string to be used for combining a directory/device prefix */
  92. /* with a base file name.  The file name is known to not be absolute. */
  93. extern char *gp_file_name_concat_string(P4(const char *prefix, uint plen,
  94.                        const char *fname, uint len));
  95.  
  96. /* ------ File operations ------ */
  97.  
  98. /* If the file given by fname exists, fill in its status and return 1; */
  99. /* otherwise return 0. */
  100. typedef struct file_status_s {
  101.     long size_pages;
  102.     long size_bytes;
  103.     long time_referenced;
  104.     long time_created;
  105. } file_status;
  106. extern int gp_file_status(P2(const char *fname, file_status *pstatus));
  107.  
  108. /* ------ File enumeration ------ */
  109.  
  110. struct file_enum_s;    /* opaque to client, defined by implementor */
  111. typedef struct file_enum_s file_enum;
  112.  
  113. /*
  114.  * Begin an enumeration.  pat is a C string that may contain *s or ?s.
  115.  * The implementor should copy the string to a safe place.
  116.  * If the operating system doesn't support correct, arbitrarily placed
  117.  * *s and ?s, the implementation should modify the string so that it
  118.  * will return a conservative superset of the request.  E.g., if the OS
  119.  * doesn't implement ? (single-character wild card), any consecutive
  120.  * string of ?s should be interpreted as *.  Note that \ can appear in
  121.  * the pattern also, as a quoting character.
  122.  */
  123. extern file_enum *gp_enumerate_files_init(P4(const char *pat, uint patlen,
  124.                          proc_alloc_t palloc,
  125.                          proc_free_t pfree));
  126.  
  127. /*
  128.  * Return the next file name in the enumeration.  The client passes in
  129.  * a scratch string and a max length.  If the name of the next file fits,
  130.  * the procedure returns the length.  If it doesn't fit, the procedure
  131.  * returns max length +1.  If there are no more files, the procedure
  132.  * returns -1.
  133.  */
  134. extern uint gp_enumerate_files_next(P3(file_enum *pfen, char *ptr, uint maxlen));
  135.  
  136. /*
  137.  * Clean up a file enumeration.  This is only called to abandon
  138.  * an enumeration partway through: ...next should do it if there are
  139.  * no more files to enumerate.  This should deallocate the file_enum
  140.  * structure and any subsidiary structures, strings, buffers, etc.
  141.  */
  142. extern void gp_enumerate_files_close(P1(file_enum *pfen));
  143.